package com.mew.lobby.message.request;

import com.zebra.common.ZebraBaseMessage;
import io.netty.buffer.ByteBuf;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @Date 2019/8/21 0021
 **/
@Data
@ToString
@NoArgsConstructor
public class ReconnectLobbyRequestMessage extends ZebraBaseMessage<ReconnectLobbyRequestMessage> {

    private long uid;
    private byte devicesType; //1,手机， 2: "模拟器" ,
    private String mac;
    private String ip;

    @Override
    public void write(ByteBuf b) {

        writeLong(b, this.uid);

        writeByte(b, this.devicesType);
        writeString(b, this.mac);
        writeString(b, this.ip);

    }

    @Override
    public ReconnectLobbyRequestMessage read(ByteBuf b) {
        ReconnectLobbyRequestMessage message = new ReconnectLobbyRequestMessage();
        message.uid = readLong(b);

        message.devicesType = readByte(b);
        message.mac = readString(b);
        message.ip = readString(b);
        return message;
    }
}
